package pl.ydp.utils.validators
{
	import flexunit.framework.TestCase;
	
	public class HasFunctionTest extends TestCase
	{
		public function testWithPublicFunction():void
		{
			var object:ClassWithPublicFunction = new ClassWithPublicFunction();
			
			var hasFunc:Boolean = hasFunction( object, 'func');
			
			assertTrue( hasFunc );
		}
		
		public function testWithPrivateFunction():void
		{
			var object:ClassWithPrivateFunction= new ClassWithPrivateFunction();
			
			var hasFunc:Boolean = hasFunction( object, 'func');
			
			assertFalse( hasFunc );
		}
		
		public function testWithNoFunction():void
		{
			var object:ClassWithNoFunction = new ClassWithNoFunction();
			
			var hasFunc:Boolean = hasFunction( object, 'func');
			
			assertFalse( hasFunc );
		}
		
		public function testWithNullObject():void
		{
			var object:Object;
			
			var hasFunc:Boolean = hasFunction( object, 'func');
			
			assertFalse( hasFunc );
		}
	}
}


class ClassWithPublicFunction
{
	public function func():void
	{
		
	}	
}

class ClassWithPrivateFunction
{
	private function func():void
	{
		
	}	
}

class ClassWithNoFunction
{
}